package cn.wolfcode.luowowo2.mgrsite.web.controller;

import cn.wolfcode.luowowo2.article.domain.StrategyTheme;
import cn.wolfcode.luowowo2.article.service.IStrategyThemeService;
import cn.wolfcode.luowowo2.common.query.StrategyThemeQueryObject;
import cn.wolfcode.luowowo2.common.util.AjaxResult;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Albert on 2019/7/9.
 */
@Controller
@RequestMapping("strategyTheme")
public class StrategyThemeController {
    @Reference
    private IStrategyThemeService strategyThemeService;

    @RequestMapping("list")
    public String list(Model model, StrategyThemeQueryObject qo){
        PageInfo<StrategyTheme> pageInfo = strategyThemeService.query(qo);
        model.addAttribute("pageInfo",pageInfo);
        return "strategyTheme/list";
    }

    @RequestMapping("saveOrUpdate")
    @ResponseBody
    public AjaxResult saveOrUpdate(StrategyTheme strategyTheme){
        strategyThemeService.saveOrUpdate(strategyTheme);
        return new AjaxResult();
    }
}
